using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using IBatisNet.DataMapper;
using Domain;
using Persistence.IDao;

namespace Persistence.Dao {
	
    /// <summary><c>OrderDetailKouDao</c> is the implementation of <see cref="IOrderDetailKouDao"/>.</summary>
    public partial class OrderDetailKouDao : BaseMap, IOrderDetailKouDao {
		
		///<summary>get models by condition</summary>
		public IList<OrderDetailKou> GetModels(string columnNames , string condition)
		{
			Hashtable ht = new Hashtable();
			ht.Add("columnNames",columnNames);
			ht.Add("condition",condition);
			String stmtId = "OrderDetailKou.GetModelsByCondition";
			IList<OrderDetailKou> result = Mapper.QueryForList<OrderDetailKou>(stmtId, ht);
			return result;
		}
		
		///<summary>get paged models by condition</summary>
		public IList<OrderDetailKou> GetModels(string columnNames,string condition,string orderBy,int pageSize ,int pageIndex)
		{
			Hashtable ht = new Hashtable();
			ht.Add("columnNames",columnNames);
			ht.Add("condition",condition);
			ht.Add("orderBy",orderBy);
			ht.Add("startNo",(pageIndex-1)*pageSize);
			ht.Add("endNo",pageSize*pageIndex);
			String stmtId = "OrderDetailKou.GetModelsByConditionByPager";
			IList<OrderDetailKou> result = Mapper.QueryForList<OrderDetailKou>(stmtId, ht);
			return result;
		}
		
		/// <summary>get all count</summary>
		public int GetCount() {
			String stmtId = "OrderDetailKou.GetCount";
			int result = Mapper.QueryForObject<int>(stmtId, null);
			return result;
		}

		/// <summary>get counts by condition</summary>
		public int GetCount(string condition) {
			Hashtable ht = new Hashtable();
			ht.Add("condition",condition);
			String stmtId = "OrderDetailKou.GetCountByCondition";
			int result = Mapper.QueryForObject<int>(stmtId, ht);
			return result;
		}
		
		/// <summary>Implements <see cref="IOrderDetailKouDao.GetModel"/></summary>
		public OrderDetailKou GetModel(Int32 id) {
			String stmtId = "OrderDetailKou.GetModel";
			OrderDetailKou result = Mapper.QueryForObject<OrderDetailKou>(stmtId, id);
			return result;
		}


		/// <summary>Implements <see cref="IOrderDetailKouDao.Insert"/></summary>
		public void Insert(OrderDetailKou obj) {
			if (obj == null) throw new ArgumentNullException("obj");
			String stmtId = "OrderDetailKou.Insert";
			Mapper.Insert(stmtId, obj);
		}
		
		/// <summary>Implements <see cref="IOrderDetailKouDao.Update"/></summary>
		public bool Update(OrderDetailKou obj) {
			if (obj == null) throw new ArgumentNullException("obj");
			String stmtId = "OrderDetailKou.Update";
			return Mapper.Update(stmtId, obj)>0;
		}
		
		/// <summary>Implements <see cref="IOrderDetailKouDao.Delete"/></summary>
		public bool Delete(OrderDetailKou obj) {
			if (obj == null) throw new ArgumentNullException("obj");
			String stmtId = "OrderDetailKou.Delete";
			return Mapper.Delete(stmtId, obj)>0;
		}
		


	}

}
